//
//  ConfirmBox.hpp
//  client
//
//  Created by DuanHongbo on 15/12/21.
//
//

#ifndef ConfirmBox_hpp
#define ConfirmBox_hpp

#include <stdio.h>

#include "cocos2d.h"
#include "editor-support/cocostudio/CocoStudio.h"
#include "ui/CocosGUI.h"
#include <functional>

using namespace cocos2d;

class ConfirmBox : public cocos2d::Layer
{
public:
    typedef std::function<void(ConfirmBox*)>  ButtonClickDelegate;
public:

    CREATE_FUNC(ConfirmBox);
    
    // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
    virtual bool init();

    void setTitle(const char* str);
    void setMessage(const char* str);
    
    void setConfirmButton(const char* str);
    void setCancelButton(const char* str);
    
    void setConfirmCallback(const ButtonClickDelegate& delegate);
    void setCancelCallback(const ButtonClickDelegate& delegate);
private:
    ButtonClickDelegate _confirmCallback;
    ButtonClickDelegate _cancelCallback;
    Node* _rootNode;
    cocos2d::ui::Text* _messageLabel;
    cocos2d::ui::Text* _confirmLabel;
    cocos2d::ui::Text* _cancelLabel;
};


#endif /* ConfirmBox_hpp */
